package com.ssy.lingxi.transaction.api.enums;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
* 商品询价-外部状态
* @author wrc
* @date 2020/11/18
*/
public enum InquiryExternalStatusEnum {

    INQUIRY_SHEET_TO_BE_SUBMITTED(1,"待提交询价单"),
    QUOTATION_TO_BE_SUBMITTED(2,"待提交报价单"),
    QUOTATION_TO_BE_CONFIRMED(3,"待确认报价单"),
    ACCEPT_OFFER(4,"接受报价"),
    OFFER_NOT_ACCEPTED(5,"不接受报价");

    /**
     *状态
     */
    private Integer state;

    /**
     *描述
     */
    private String name;

    public static String getName(Integer state){
        InquiryExternalStatusEnum workEnum = Arrays.stream(InquiryExternalStatusEnum.values()).filter(v -> v.getState().equals(state)).findAny().orElse(null);
        return null == workEnum ? "" : LanguageHolder.getName(InquiryExternalStatusEnum.class, workEnum.getState());
    }

    InquiryExternalStatusEnum(Integer state, String name) {
        this.state = state;
        this.name = name;
    }

    /**
     * 获取所有的状态值
     *
     * @return
     */
    public static List<Integer> getStateList() {
        return Arrays.stream(InquiryExternalStatusEnum.values())
                .map(InquiryExternalStatusEnum::getState)
                .collect(Collectors.toList());
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getName() {
        return LanguageHolder.getName(this.getClass(), this.state);
    }

    public void setName(String name) {
        this.name = name;
    }
}
